// 引入API
import { createRouter, createWebHashHistory } from "vue-router"

// 引入了两个页面
const Home = () => import("../views/Home.vue")
const About = () => import("../views/About.vue")
const VuexPage = () => import("../views/Vuex.vue")
const NotFound = () => import("../views/404.vue")

// 引入AxiosTest 页
const AxiosTest = () => import("../views/AxiosTest.vue")

const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        name: 'home',
        component: Home
    },
    {
        path: '/about',
        name: 'about',
        component: About
    },
    {
        path: '/vuex',
        name: 'vuex',
        component: VuexPage
    },
    {
        path: '/axios-test',
        name: 'axiosTest',
        component: AxiosTest
    },
    {
        path: '/:pathMatch(.*)*',
        name: 'notFound',
        component: NotFound
    }
]

// 创建了一个路由的实例化对象
const router = createRouter({
    history: createWebHashHistory(),
    routes
})
// route
// router
export default router